<template>
	<view class="seed-detail-page page">
		<view class="content-block">
			<view class="white-block">
				<view class="block-title FZHZGBJ">基地基本信息</view>
				<view class="info-list">
					<view class="name">基地名称</view>
					<view class="info-item">
						<view class="info-value">{{detail.title||'暂无基地名称'}}</view>
					</view>
				</view>
				<view class="info-list">
					<view class="name">基地地址</view>
					<view class="info-item">
						<view class="info-value">{{detail.address||'暂无位置'}}</view>
						<view v-if="detail.address" @click="openMap(detail.latitude,detail.longitude,detail.address)"
							class="operate-btn">
							<view class="iconfont iconfont-btn icon-daohang"></view>地图
						</view>
					</view>
				</view>
				<view class="info-list">
					<view class="name">基地电话</view>
					<view class="info-item">
						<view class="info-value">{{detail.phone||'暂无联系方式'}}</view>
						<view v-if="detail.phone" @click="call(detail.phone)" class="operate-btn">
							<view class="iconfont iconfont-btn icon-dianhua"></view>拨打
						</view>
					</view>
				</view>
			</view>
			<view class="white-block">
				<view class="block-title FZHZGBJ">基地简介</view>
				<view class="content">
					<template v-if="detail.introduction&&detail.introduction.length>0">
						<mp-html :content="detail.introduction"></mp-html>
					</template>
					<view v-else class="empty">暂无简介</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				detail: {
					title: '农林产教研发中心',
					phone: '17609372189',
					address: '甘肃酒泉市肃州区解放路66号',
					latitude: '39.74502',
					longitude: '98.50801',
					introduction: '简介'
				}
			}
		},
		methods: {
			getDetail(id) {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				Detail({
					id
				}).then(res => {
					this.detail = res;
				})
			}
		},
		onLoad(opt) {
			if (!opt.id) {
				this.showToast('参数错误', () => {
					uni.navigateBack()
				})
				return;
			}
			//this.getDetail(opt.id)
		}
	}
</script>

<style lang="scss" scoped>
	.seed-detail-page {
		width: 100%;
		overflow: hidden;

		.content-block {
			background: #F7F6F9;
			border-radius: 20px;
			padding: 30rpx;
			z-index: 1;
			position: relative;

			.white-block {
				background: #fff;
				border-radius: 8px;
				padding: 30rpx;
				display: flex;
				flex-direction: column;
				margin-bottom: 30rpx;

				.info-list {
					border-bottom: 1px solid #efefef;

					.name {
						font-size: 30rpx;
						margin-top: 30rpx;
					}

					.info-item {
						width: 100%;
						height: 100rpx;
						display: flex;
						align-items: center;
						justify-content: space-between;

						.info-value {
							width: calc(100% - 160rpx);
							text-overflow: ellipsis;
							overflow: hidden;
							white-space: nowrap;
						}

						.iconfont {
							font-weight: bold;
							color: #000;
							width: 50rpx;
							font-size: 38rpx;
							margin-right: 20rpx;
						}

						.operate-btn {
							width: 160rpx;
							border-radius: 20px;
							border: 1px solid $theme-color;
							height: 60rpx;
							display: flex;
							align-items: center;
							justify-content: center;
							color: $theme-color;

							.iconfont-btn {
								font-size: 34rpx;
								margin-right: 10rpx;
								width: auto;
								color: $theme-color;
							}
						}
					}
				}

				.info-list:last-child {
					border-bottom: none;
				}

				.block-title {
					margin-bottom: 20rpx;
					color: #64B548;
				}

				.content {
					line-height: 1.6;
					text-align: justify;
				}
			}
		}
	}
</style>